#!/usr/bin/env bash

# Author:   Zhang Huangbin (zhb(at)iredmail.org)

#---------------------------------------------------------------------
# This file is part of iRedMail, which is an open source mail server
# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
#
# iRedMail is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# iRedMail is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with iRedMail.  If not, see <http://www.gnu.org/licenses/>.
#---------------------------------------------------------------------

# Variables for pysieved.
export PYSIEVED_INI='/etc/pysieved.ini'
export PYSIEVED_BINDADDR='127.0.0.1'
export PYSIEVED_PORT='2000'    # default is '2000'

# We will run pysieved service as vmail user/group, but they can't
# write pid file under '/var/run/', so we create a subdirectory for
# this purpose.
export PYSIEVED_PIDFILE='/var/run/pysieved/pysieved.pid'

# Variables for managesieve service.
export MANAGESIEVE_BINDADDR="${PYSIEVED_BINDADDR}"
export MANAGESIEVE_PORT='2000'

if [ X"${DISTRO}" == X"RHEL" -a X"${DISTRO_VERSION}" == X"6" ]; then
    export MANAGESIEVE_PORT='4190'
fi

if [ X"${DISTRO_CODENAME}" == X"squeeze" ]; then
    # Debian 6 changes default managesieve port to 4190.
    export MANAGESIEVE_PORT='4190'
fi
